package worldcup;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class Test {
    public static void main(String[] args) {
        Map<Integer,WorldCup> map = new HashMap<>();
        map.put(2006,new WorldCup(2006,"意大利"));
        map.put(2014,new WorldCup(2014,"德国"));
        map.put(2010,new WorldCup(2010,"西班牙"));
        map.put(2002,new WorldCup(2002,"巴西"));
        map.put(1998,new WorldCup(1998,"法国"));
        Iterator<WorldCup> itF = map.values().iterator();
        while (itF.hasNext()) {
            System.out.print(itF.next()+"  ");
        }
        System.out.println();
        Set<Map.Entry<Integer, WorldCup>> entrySet = map.entrySet();
        for (Map.Entry<Integer, WorldCup> entry : entrySet) {
            System.out.print(entry.getKey() + "-");
            System.out.println(entry.getValue());
        }
    }
}
